<template>
	<view class="gradens-yhrw-report">
		<view class="gradens-yhrw-view-card">
			<view class="yhrw-view-list-item">
				<view class="yhrw-view-list-name">任务名称:</view>
				<text class="yhrw-view-list-text">{{examineReport.taskName}}</text>
			</view>
			<view class="yhrw-view-list-item">
				<view class="yhrw-view-list-name" style="width: auto">任务开始时间:</view>
				<text class="yhrw-view-list-text"
					style="margin-left: 10rpx">{{examineReport.taskStartTime | date('yyyy年mm月dd日')}}</text>
			</view>
			<view class="" style="display: flex; justify-content: space-between">
				<view class="yhrw-view-list-item">
					<view class="yhrw-view-list-name">上报完成进度:</view>
					<text style="margin-left: 10rpx" class="yhrw-view-list-text">{{examineReport.schedule}}%</text>
				</view>
				<view class="yhrw-view-list-item">
					<view class="yhrw-view-list-name">当前操作人:</view>
					<text class="yhrw-view-list-text">{{name}}</text>
				</view>
			</view>
			<view class="" style="display: flex; justify-content: space-between">
				<view class="yhrw-view-list-item">
					<view class="yhrw-view-list-name">考评对象:</view>
					<text style="margin-left: 10rpx" class="yhrw-view-list-text">{{examineReport.objName}}</text>
				</view>
				<view class="yhrw-view-list-item">
					<view class="yhrw-view-list-name">考评监督小组:</view>
					<text class="yhrw-view-list-text">{{examineReport.groupName}}</text>
				</view>
			</view>
			<view class="" style="border-bottom: 1px solid #c5c5c5; margin-top: 20rpx"></view>
			<view class="" style="display: flex; justify-content: space-between">
				<view class="yhrw-view-list-item">
					<view class="yhrw-view-list-name">考核内容</view>
				</view>
				<view class="yhrw-view-list-item">
					<view style="margin-right: 10rpx">总分值:</view>
					<text class="yhrw-view-list-text">{{100-sumBuckleScore}}</text>
				</view>
				<view class="yhrw-view-list-item">
					<view style="margin-right: 10rpx">扣分:</view>
					<text class="yhrw-view-list-text">{{sumBuckleScore}}分</text>
				</view>
			</view>
			<view style="margin-top: 20rpx; height: 650rpx; overflow: auto">
				<uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据"
					>
					<uni-tr>
						<uni-th width="200rpx" align="left">考核大类</uni-th>
						<uni-th width="200rpx" align="left">考核小类</uni-th>
						<uni-th width="150rpx" align="left">内容</uni-th>
						<uni-th width="150rpx" align="left">操作</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in examineLevelList" :key="index">
						<uni-td>{{item.firstLevelName}}</uni-td>
						<uni-td>{{item.twoLevelName}}</uni-td>
						<uni-td>
							<view class="name">{{ item.threeLevelName }}</view>
						</uni-td>
						<uni-td>
							<uni-tag @click="gopath(item)"  :inverted="true" :text="item.text" type="primary" />
						</uni-td>
					</uni-tr>
				</uni-table>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		listExamineReport,
		getExamineReport,
		delExamineReport,
		addExamineReport,
		updateExamineReport,
	} from "@/api/comp/examineReport";
	import {
		listExamineFeedback,
		getExamineFeedback,
		updateExamineFeedback,
		getSumBuckleScore,
	} from "@/api/comp/examineFeedback";
	import {
		mapState
	} from "vuex";
	export default {
		computed: {
			...mapState({
				name: (state) => state.user.name,
				userInfo: (state) => state.user.userInfo,
			}),
		},
		data() {
			return {
				date: new Date(),
				// showCalendar: false,
				searchVal: "",
				// 每页数据量
				loading: false,
				formData: {
					tb_nr: "",
					jidu: "",
					image: "",
				},
				examineReport: {},
				examineLevelList: [],
				sumBuckleScore: null,
				options:{},
			};
		},
		onLoad(options) {
			this.selectedIndexs = []
			this.options = options
			this.getInfo()
		},
		methods: {
			getInfo() {
				getExamineReport(this.options.id).then(res => {
					if (res.data) {
						this.examineReport = res.data
						this.$set(this.examineReport, 'groupName', this.options.groupName || '')
						this.$set(this.examineReport, 'objName', this.options.objName || '')
					}

				})
				this.getExamineLevelList(this.options.id);
			},
			// 指标列表
			getExamineLevelList(id) {
				listExamineFeedback({
					reportId: id
				}).then((response) => {
					this.examineLevelList = response.rows;
					this.examineLevelList.map(item=>{
						if(item.buckleScore){
							this.$set(item,'text','修改')
						}else{
							this.$set(item,'text','填写')
						}
					})
					this.total =  response.total
				});
				getSumBuckleScore(id).then((response) => {
					this.sumBuckleScore = response;
				});
			},
			gopath(row) {
				uni.navigateTo({
					url: `/pages/gardens/khdj/kgtx?id=${this.options.id}&groupName=${this.options.groupName}&objName=${row.objName}&objName2=${this.options.objName}&firstLevelName=${row.firstLevelName}&threeLevelName=${row.threeLevelName}&twoLevelName=${row.twoLevelName}&rowId=${row.id}&buckleScore=${row.buckleScore}&examineRemark=${row.examineRemark}&threeLevelScore=${row.threeLevelScore}`
				})

			},
			backClick() {
				uni.navigateBack();
			},
			// 搜索
			search() {
				this.getData(1, this.searchVal);
			},
			goImage() {},
		},
	};
</script>

<style lang="scss">
	$nav-height: 30px;

	.box-bg {
		background-color: #f5f5f5;
		padding: 5px 0;
	}

	.city {
		/* #ifndef APP-PLUS-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		// width: 160rpx;
		margin-left: 4px;
	}

	.input-uni-icon {
		line-height: $nav-height;
	}

	.gradens-yhrw-view-card {
		box-sizing: border-box;
		padding: 10rpx 10px;
	}

	.gradens-yhrw-report {
		.yhrw-view-list-item {
			display: flex;
			padding-top: 20rpx;
			align-items: center;

			.yhrw-view-list-name {
				color:#9DA0AA;
				font-size: 24rpx;
			}

			.yhrw-view-list-text {
				flex: 1;
				color:#353B50;
				font-size: 24rpx;
				margin-left: 20rpx;
			}
		}
	}
</style>